package org.map;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import org.standard.Utility;

public class MapGridCell extends Canvas implements MouseListener {	
	private Image screen;
	private Graphics2D graphics;

	public MapGridCell() {
		screen = Utility.createImage(32, 32, true);
		this.setPreferredSize(new Dimension(32, 32));
		graphics = (Graphics2D) screen.getGraphics();
		this.addMouseListener(this);
	}

	public void paint(Graphics g) {
		g.drawImage(screen, 0, 0, null);
		g.dispose();
	}

	public void update(Graphics g) {
		paint(g);
	}

	@Override
	public void mouseClicked(MouseEvent e) {
		// TODO Auto-generated method stub
		graphics.drawImage(MapGrid.selImage, 0, 0, null);
		this.repaint();
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub

	}
}
